from ..original.carriers_api import CarriersAPI


class Carriers(object):

    @classmethod
    def get_carriers(cls):
        """
        获取所有承运商（已接入）
        :return :
            {"Carriers":
                {"Correos": [{"CarrierID": "469",
                             "CarrierService": "PAQ 72 Home Delivery",
                             "ServicesList": ["PAQ 72 Home Delivery"],
                             "Label": "steph",
                             "CarrierLogo": "https:\/\/cdn.shippypro.com\/assets\/images\/carriers\/correos.png"},
                            {"CarrierID": "490",
                             "CarrierService": "PAQ 72 Postal Office Delivery",
                             "ServicesList": ["PAQ 72 Postal Office Delivery"],
                             "Label": "",
                             "CarrierLogo": "https:\/\/cdn.shippypro.com\/assets\/images\/carriers\/correos.png"}
                            ],
                "GLSSpain": [{"CarrierID": "802",
                             "CarrierService": "EuroBusiness Parcel",
                             "ServicesList": ["EuroBusiness Parcel"],
                             "Label": "",
                             "CarrierLogo": "https://cdn.shippypro.com/assets/images/carriers/glsspain.png"}
                            ],
                }
            }
        """
        return CarriersAPI.get_carriers()


    @classmethod
    def get_carrier_options(cls, carrier_name, carrier_id, country_code, postal_code, city_name):
        """
        根据承运商和城市，获取增值服务
        :param carrier_name 承运商名称
        :param carrier_id 承运商服务ID(shippypro提供)
        :param country_code 国家代码
        :param postal_code 邮编
        :param city_name 城市名称
        """
        return CarriersAPI.get_carriers_options(carrier_name=carrier_name,
                                                        carrier_id=carrier_id,
                                                        country=country_code,
                                                        postal_code=postal_code,
                                                        city=city_name)
        

    @classmethod
    def get_carrier_package_types(cls):
        """ 获取所有承运商（已接入）的所有可用包裹类型 """
        return CarriersAPI.get_carrier_packages_type()
        